﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using XCommunity.Metas;

namespace XCommunity.Documents
{

  /// <summary>
  /// 代表一个文档的元数据
  /// </summary>
  public class DocumentMeta
  {

    public DocumentMeta()
    {
      Saved = false;
    }

    /// <summary>
    /// 文档标题
    /// </summary>
    public string Caption
    {
      get;
      set;
    }

    /// <summary>
    /// 文档作者
    /// </summary>
    public string Author
    {
      get;
      internal set;
    }

    /// <summary>
    /// 指示文档和元数据是否已经被保存
    /// </summary>
    public bool Saved
    {
      get;
      internal set;
    }

    
    private int _id;
    
    /// <summary>
    /// 文档编号
    /// </summary>
    public int DocumentId
    {
      get
      {
        if ( !Saved )
          throw new InvalidOperationException();
        return _id;
      }

      internal set
      {
        _id = value;
      }
    }

  }
}
